/**
 ******************************************************
 * 作者:朱雍
 * 备注:
 * 时间:2017年3月15日上午8:18:58
 * Copyright (c) 2017, 243813208@qq.com All Rights Reserved.
 ******************************************************
 */

package cn.sxt.yxl.controller;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import cn.sxt.yxl.common.util.ConstatFinalUtil;
import cn.sxt.yxl.users.pojo.AAdmins;
import cn.sxt.yxl.users.service.IUserService;

/**
 * 类名:NoLoginController 
 * 备注:	 
 * 时间:2017年3月15日 上午8:18:58
 * 作者:朱雍
 * @since  	JDK 1.8	 
 */
@Controller
public class NoLoginController {
	@Resource
	private IUserService userService;
	@RequestMapping(value="/adminsList",method={RequestMethod.POST})
	public String list(HttpServletRequest request){
		ConstatFinalUtil.LOGGER.info("请求方式：{}",request.getMethod());
		//获取请求头里的内容
		Enumeration<String> enumeration = request.getHeaderNames();
		while (enumeration.hasMoreElements()) {
			String key = enumeration.nextElement();
			System.out.println(key+"=============="+request.getHeader(key));
		}
		
		//获取参数
		Map<String, String[]> params = request.getParameterMap();
		Set<Entry<String, String[]>> entrySet = params.entrySet();
		for (Entry<String, String[]> entry : entrySet) {
			String key = entry.getKey();
			String value = entry.getValue()[0];
			System.out.println("参数："+key+"="+value);
		}
		
		Map<String, Object> condMap = new HashMap<>();
		List<AAdmins> list = userService.findCondAdminsList(null, condMap);
		request.setAttribute("list", list);
		return "/head/adminsList";
	}
}

